import { TOKEN_KEY } from '@/constants'
// 通过 Cookie 实现持久化存储
import Cookies from 'js-cookie'

// export const getToken = () => {
//   return localStorage.getItem(TOKEN_KEY)
// }

// export const setToken = (token: string) => {
//   localStorage.setItem(TOKEN_KEY, token)
// }

// export const removeToken = () => {
//   localStorage.removeItem(TOKEN_KEY)
// }

// 获取 token
export const getLocalToken = () => {
  return Cookies.get(TOKEN_KEY)
}

// 设置 token
export const setLocalToken = (token: string) => {
  Cookies.set(TOKEN_KEY, token)
}

// 删除 token
export const removeLocalToken = () => {
  Cookies.remove(TOKEN_KEY)
}